#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	int n,m;
	cin>>n>>m;
	long long a[n+1];
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
	}
	long long x,y,z,p;
	for(int i=1;i<=m;i++)
	{
		scanf("%lld",&x);
		if(x==1)
		{
			scanf("%lld%lld",&y,&z);
			a[y]=z;
		}
		if(x==2)
		{
			scanf("%lld",&y);
			p=1;
			for(int j=1;j<=n;j++)
			{
				if(a[j]<a[y]||(a[j]==a[y]&&j<y))
				{
					p++;
				}
			}
			printf("%lld\n",p);
		}
	}
}
